layui.define(['form', 'laydate', 'table'], function (exports) {
    var form = layui.form;
    var index = layui.index;
    var view = {
        init: function () {
            Lib.initGenrealForm($("#updateForm"), form);
            this.initSubmit();
        },
        initSubmit: function () {
            var _this = this;
            $("#acceptance-termination").click(function () {

                    form.on('submit(form)', function () {
                            Common.openConfirm("确认终止?", function () {
                                var callback = function () {
                                    parent.window.dataReload();
                                    Common.info("终止成功");
                                    Lib.closeFrame();
                                    parent.forChildWindow();

                                };
                                Lib.submitForm("/cms/buyHouseSubsidies/firstcheckTerminal.json", $('#updateForm'), {}, callback);
                            }, null);

                    });
            });
            $("#acceptance-return").click(function () {

                    form.on('submit(form)', function () {
                            Common.openConfirm("确认退回?", function () {
                                var callback = function () {
                                    parent.window.dataReload();
                                    Common.info("退回成功");
                                    Lib.closeFrame();
                                    parent.forChildWindow();

                                };
                                    Lib.submitForm("/cms/buyHouseSubsidies/firstcheckBack.json", $('#updateForm'), {}, callback);
                            }, null);
                    });
            });
            $("#acceptance-adopt").click(function () { if(document.getElementById("handlingSuggestion").value.trim() == ''){                 $("#handlingSuggestion").val("通过");             }
                    form.on('submit(form)', function () {
                        var f = function() {
                            Common.openConfirm("确认通过?", function () {
                                var callback = function () {
                                    parent.window.dataReload();
                                    Common.info("通过成功");
                                    Lib.closeFrame();
                                    parent.forChildWindow();

                                };
                                Lib.submitForm("/cms/buyHouseSubsidies/firstcheckPass.json", $('#updateForm'), {}, callback);
                            }, null);
                        }
                        Common.validAll(f);
                    });
                });
        }
    }
    exports('chushenedit', view);

});